<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
  <body class="nav-md">
      <div class="">
        <div class="page-title">
          <div class="title_left">
            <h3>权限管理</h3>
          </div>
          <div class="title_right">
            <div class="pull-right">
                <a onclick="showUserAddModal()" class="btn btn-app">
                    <i class="fa fa-file"></i>新增
                </a>
            </div>
          </div>
        </div>

        <div class="clearfix"></div>

        <div class="row">
            <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                  <div class="x_title">
                    <h2>用户列表</h2>
                    <div class="clearfix"></div>
                  </div>

                  <div class="x_content">
                    <table id="datatable" class="table table-striped table-bordered">
                      <thead>
                        <tr>
                          <th>账号</th>
                          <th>姓名</th>
                          <th>身份</th>
                          <th>状态</th>
                          <th>生成时间</th>
                          <th>操作</th>
                        </tr>
                      </thead>
                      <tbody>
                        <tr th:each="user : ${userList}">
                          <td th:text="${user.userName}">Tiger Nixon</td>
                          <td th:text="${user.realName}">System Architect</td>
                          <td th:text="${user.roleTypeStr}">Edinburgh</td>
                          <td th:text="${user.statusStr}">61</td>
                          <td th:text="${user.createdDateStr}">2011/04/25</td>
                          <td>
                              <a th:if="${user.status} == 1" class="btn btn-danger btn-xs" th:onclick="'javascript:closePermission(\''+ ${user.id}+'\')'"><i class="fa fa-ban"></i> 关闭权限</a>
                              <a th:if="${user.status} == 0" class="btn btn-primary btn-xs" th:onclick="'javascript:getUserInfo(\''+ ${user.id}+'\')'"><i class="fa fa-edit"> </i> 编辑</a>
                              <a th:if="${user.status} == 0" class="btn btn-success btn-xs" th:onclick="'javascript:openPermission(\''+ ${user.id}+'\')'"><i class="fa fa-check-circle-o"></i> 开通权限</a>
                              <a class="btn btn-warning btn-xs" th:onclick="'javascript:resetPassword(\''+ ${user.id}+'\')'"><i class="fa fa-refresh"></i> 重置密码</a>
                          </td>
                        </tr>
                      </tbody>
                    </table>
                  </div>
                </div>
            </div>
        </div>
      </div>
      <div class="modal fad" id="userAddModal" tabindex="-1" role="dialog" aria-labelledby="myModallabel">
          <div class="modal-dialog" role="document">
              <div class="modal-content">
                  <div class="modal-header">
                      <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                      <h4 class="modeal-title" id="myModalLabel">新增</h4>
                  </div>
                  <div class="modal-body">
                      <div class="form-group">
                          <label for="userName" style="float: left; margin-left: 10%; margin-right: 3%; margin-top: 1.5%">账号：</label>
                          <input type="text" id="userName" name="userName" class="form-control" style="width: 70%;">
                      </div>
                      <div class="form-group">
                          <label for="realName" style="float: left; margin-left: 10%; margin-right: 3%; margin-top: 1.5%">姓名：</label>
                          <input type="text" id="realName" name="realName" class="form-control"style="width: 70%;">
                      </div>
                      <div class="form-group">
                          <label for="roleType" style="float: left; margin-left: 10%; margin-right: 3%; margin-top: 1.5%">身份：</label>
                          <select name="roleType" id="roleType" class="form-control" style="width: 70%;">
                              <option value="0">管理员</option>
                              <option value="1">讲师</option>
                          </select>
                      </div>
                  </div>
                  <div class="modal-footer">
                      <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                      <button id="btnAddUser" type="button" class="btn btn-primary" onclick="addUser()">新增</button>
                  </div>
              </div>
          </div>
      </div>

      <div class="modal fad" id="userUpdateModal" tabindex="-1" role="dialog" aria-labelledby="myModallabel">
          <div class="modal-dialog" role="document">
              <div class="modal-content">
                  <div class="modal-header">
                      <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                      <h4 class="modeal-title" id="myModalLabel">修改</h4>
                  </div>
                  <div class="modal-body">
                      <input id="idUpdate" name="idUpdate" style="display:none;">
                      <div class="form-group">
                          <label for="userNameUpdate" style="float: left; margin-left: 10%; margin-right: 3%; margin-top: 1.5%">账号：</label>
                          <input type="text" id="userNameUpdate" name="userNameUpdate" class="form-control" style="width: 70%;">
                      </div>
                      <div class="form-group">
                          <label for="realNameUpdate" style="float: left; margin-left: 10%; margin-right: 3%; margin-top: 1.5%">姓名：</label>
                          <input type="text" id="realNameUpdate" name="realNameUpdate" class="form-control"style="width: 70%;">
                      </div>
                      <div class="form-group">
                          <label for="roleTypeUpdate" style="float: left; margin-left: 10%; margin-right: 3%; margin-top: 1.5%">身份：</label>
                          <select name="roleTypeUpdate" id="roleTypeUpdate" class="form-control" style="width: 70%;">
                              <option value="0">管理员</option>
                              <option value="1">讲师</option>
                          </select>
                      </div>
                  </div>
                  <div class="modal-footer">
                      <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                      <button type="button" class="btn btn-primary" onclick="updateUser()">修改</button>
                  </div>
              </div>
          </div>
      </div>
    <script src="../cms/js/user.js"></script>
  </body>
</html>